package com.csi.service.impl;

import com.csi.domain.UserAssess;
import com.csi.mapper.AssessMapper;
import com.csi.mapper.UserBookMapper;
import com.csi.service.AssessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AssessServiceImpl implements AssessService {

    @Autowired
    private AssessMapper assessMapper;
    @Autowired
    private UserBookMapper userBookMapper;

    @Override
    public int save(UserAssess userAssess) {
        int updated = userBookMapper.completed(userAssess.getDueId());
        int saved = assessMapper.save(userAssess);
        return updated + saved;
    }

    @Override
    public List<UserAssess> find(long hotelId) {
        return assessMapper.find(hotelId);
    }
}
